var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
    productionSourceMap:false,
    chainWebpack: config => {
      // config.externals(['vue', 'vue-router','vuex','axios'])
    },
    configureWebpack: (config) => {
      // 生产打包配置
      config.externals = {
      // 'vue': 'Vue',
      // 'vuex': 'Vuex',
    }
      let prd_plugins = [
        // 删除console插件
        new UglifyJsPlugin({
          uglifyOptions: {
            warnings: false,
            compress: {
              drop_console: true,
              drop_debugger: true,
              pure_funcs: ['console.log']
            },
            output: {
              // 去掉注释内容
              comments: false,
            }
          },
          sourceMap: false,
          parallel: true,
        })
      ]
      if (process.env.NODE_ENV == 'production'&&process.env.VUE_APP_Vconsole=='false') {
        config.plugins = [...config.plugins, ...prd_plugins]
      }
    }
}